/*
 * 
 */
function TestSuite() {
	
	this.run = function() {
		debugConsole.toConsole("===========================");
		debugConsole.toConsole("======= UNIT ================");
		debugConsole.toConsole("===========================");
		
		
		nodeTest = new NodeTest();
		isSuccesfull = true;
		try {
			nodeTest.testConstructor();
			nodeTest.testGetF();
			nodeTest.testGetParentsCount();
		} catch(exception) {
			this.treatError(exception);
			isSuccesfull = false;
		}
		if(isSuccesfull) {
			debugConsole.toConsole("NodeTest all ok");
		} else {
			debugConsole.toConsole("NodeTest tests with errors");
		}
		
		areaTest = new AreaTest();
		isSuccesfull = true;
		try {
			areaTest.testConstructor();
			areaTest.testEdit();
		} catch(exception) {
			this.treatError(exception);
			isSuccesfull = false;
		}
		if(isSuccesfull) {
			debugConsole.toConsole("AreaTest all ok");
		} else {
			debugConsole.toConsole("AreaTest tests with errors");
		}
		
		distanceCalculatorTest = new DistanceCalculatorTest();
		isSuccesfull = true;
		try {
			distanceCalculatorTest.testGetDistance();
			distanceCalculatorTest.testGetDistance2();
			distanceCalculatorTest.testGetNeighbors();
			distanceCalculatorTest.testGetNeighbors2();
		} catch(exception) {
			this.treatError(exception);
			isSuccesfull = false;
		}
		if(isSuccesfull) {
			debugConsole.toConsole("DistanceCalculatorTest all ok");
		} else {
			debugConsole.toConsole("DistanceCalculatorTest tests with errors");
		}
		
		nodeListTest = new NodeListTest();
		isSuccesfull = true;
		try {
			nodeListTest.testConstructor();
			nodeListTest.testSearchByPosition();
			nodeListTest.testGetFirst();
		} catch(exception) {
			this.treatError(exception);
			isSuccesfull = false;
		}
		if(isSuccesfull) {
			debugConsole.toConsole("NodeListTest all ok");
		} else {
			debugConsole.toConsole("NodeListTest tests with errors");
		}
		
		nodeOpenListTest = new NodeOpenListTest();
		isSuccesfull = true;
		try {
			nodeOpenListTest.testGetLowestFNode();
			nodeOpenListTest.testRemove();
		} catch(exception) {
			this.treatError(exception);
			isSuccesfull = false;
		}
		if(isSuccesfull) {
			debugConsole.toConsole("NodeOpenListTest all ok");
		} else {
			debugConsole.toConsole("NodeOpenListTest tests with errors");
		}
		
		debugConsole.toConsole("===========================");
		debugConsole.toConsole("======= INTEGRATION ==========");
		debugConsole.toConsole("===========================");
		
		aStarTest = new AStarTest();
		isSuccesfull = true;
		try {
			aStarTest.testConstructor();
			aStarTest.testGetPath();
			aStarTest.testGetPath2();
			aStarTest.testSomewhatPassable();
		} catch(exception) {
			this.treatError(exception);
			isSuccesfull = false;
		}
		if(isSuccesfull) {
			debugConsole.toConsole("AStarTest all ok");
		} else {
			debugConsole.toConsole("AStarTest tests with errors");
		}
		
		debugConsole.toConsole("===========================");
		debugConsole.toConsole("======= PERFORMANCE ==========");
		debugConsole.toConsole("===========================");
		
		var benchmark = new Benchmark();
		benchmark.benchmarkEuclidianSmallArea();
		benchmark.benchmarkEuclidianMediumArea();
		benchmark.benchmarkEuclidianLargeArea();
		
		benchmark.benchmarkModifiedChebyshevSmallArea();
		benchmark.benchmarkModifiedChebyshevMediumArea();
		benchmark.benchmarkModifiedChebyshevLargeArea();
	};
	
	this.treatError = function(exception) {
		stackTrace = printStackTrace(exception, true);
		debugConsole.toConsole(exception);
		
		$.each(stackTrace,function(index) {
		    stackEntry = this;
		    debugConsole.toConsole("[*] "+stackEntry);
		});
	};
	
};